/**
 * 
 */
package com.mvity.framework.common.utils;

import com.mvity.framework.common.base.BaseUtil;
import com.thoughtworks.xstream.XStream;

/**
 * XML工具处理类(XStream)
 * 
 * @author vity
 * @date 2012-9-10
 * @mail vity.1215@gmail.com
 */
public final class XmlUtil extends BaseUtil {

	private static final long serialVersionUID = 6359635669474929443L;

	private volatile static XStream xStream = null;

	static {
		synchronized (XStream.class) {
			if (xStream == null) {
				xStream = new XStream();
			}
		}
	}

	private XmlUtil() {
	}

	public static String beanToXML(Object obj) {
		return xStream.toXML(obj);
	}

	public static Object fromXML(String xml) {
		return xStream.fromXML(xml);
	}

}
